// 全局混入

import Vue from "vue"
import { mapState, mapMutations } from "vuex"
import { FootList } from "."
import { reg } from "@/utils/validate"
import { ShowError, ShowSuccess } from "@/api/request"


Vue.mixin({
    data() {
        return {
            ww: "wh2210",
            FootList: FootList,
            reg
        }
    },

    mounted() {
    },
    computed: {
        ...mapState([
            'userInfo',
            "sp",
            "goods"
        ])
    },
    methods: {
        // 全局跳转
        gotopage(name) {
            this.$router.push({ name })
        },
        a() {
            var uid = this.list[0].content[0].link
            var id = uid.substr(31, 9)
            return id
        },

        // 判断用户是否登录
        checkHasLoginde(callback) {
            if (this.userInfo) {
                callback()
            } else {
                this.$dialog.alert({
                    title: "登录提示",
                    message: "你未登录，请前往登录"
                }).then(() => {
                    this.$router.push({ name: "logins" })
                })
            }
        },


        ShowError,
        ShowSuccess,
        ...mapMutations([
            'changeUserInfo',
            "goodsUser",
            "keywordUser"

        ]),
    },
})